<template>
    <div v-loading="loading"  class="minHeight">
		<div v-if="data.length>0">
			<div v-for="(item, index) in data" :key="index">
			    <div class="list-block dl-row-sb center">
			        <p @click="lookInfo(item.id,item.name)">{{item.name}}</p><span>{{parseTime(item.createtime)}}</span>
			    </div>
			</div>
			<info ref="noticeContent"/>
			<el-pagination
			        :total="total"
			        :current-page="page + 1"
			        style="margin-top: 8px;"
			        layout="total, prev, pager, next, sizes"
			        @size-change="sizeChange"
			        @current-change="pageChange"/>
		</div>
        <div  v-if="data.length==0  && !loading">
        	<el-empty class="empty" :image-size="250" :image="require('../../../assets/no_data_images/no_notice.png')" description="无收藏记录"></el-empty>
        </div>
    </div>
</template>

<script>
    import initData from '@/mixins/initData'
    import {parseTime} from '@/utils/index'
    import info from "./info";

    export default {
        name: "notice",
        components: {info},
        mixins: [initData],
        data() {
            return {
				loading:false,
                type: 1
            }
        },
        methods: {
            parseTime,
            beforeInit() {
                this.url = 'api/sysNotice'
                const sort = 'id,desc'
                this.params = {page: this.page, size: this.size, type: this.type, sort: sort, status: 1}
                return true
            },
            lookInfo(id, title) {
                this.$refs.noticeContent.title = title
                this.$refs.noticeContent.noticeId = id
                this.$refs.noticeContent.dialog = true
            }
        }
    }
</script>

<style scoped>
	.minHeight{
			min-height: calc(100vh - 304px);
		}
</style>
